I'm afraid it is something alot of us go through and is a big learning curve.One thing I remember is when I finally got over him and didn't need him anymore, he poped back again all interested.
Sometimes that is what draws us to a person even if they are no good for us. If they are being arrogant and cool then we seem to want them and if they are overbearing and wanting us then we don't need them or they are too much for us. It's a vicious circle. Do I meake sense?
I think what you need to do is affirm to yourself how important YOU are and that you deserve the very best. Take what you have learned from this relationship and move on. Love yourself, treat yourself to something nice. Take stock of what is important to you and decide on where you want to go next. I know it's hard but once you have learned to live for yourself and love yourself you won't settle for something or someone who is not good for you and he will not matter anymore.
If you want to talk about it some more, I am here I really do understand.